Intro to wind energy

Exercise 1

Map wind turbines in Rogaland from OSM and calculate the total energy capacity installed.

Objetives

  • OSM (and how get data from it)
  • Map points data (interactive map)
  • Types of data in a data frame
  • Data wrangling
  • NAs in a data frame

Solution

Load libraries

Code
library(osmdata)
library(sf)
library(tmap)

Get data from OpenStreetMap with osmdata, and transform to a sf object.

Code
query <- opq(bbox = "Rogaland", timeout = 50) |> 
   add_osm_feature(key = "generator:source", value = "wind")
data <-  osmdata_sf(query)

wind_turbines <- data$osm_points 

Interactive map with tmap.

Code
tmap_mode("view")

tm_shape(wind_turbines) +
  tm_dots(col = "#0072B2")
Figure 1: Wind turbines in Rogaland (Norway)

calculate

We are going to calculate the maximum capacity (MW) installed in the region. If we inspect the data, there is a column describing called generator:output:electricity, which give the information we are looking for in MW. Howevr we can not use it directly, we would need to transform the data to numbers, and think what to do with the NA.

Code
wind_turbines$`generator:output:electricity`
  [1] "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" NA       NA       "2.3 MW" NA      
  [9] NA       NA       NA       NA       NA       NA       NA       NA      
 [17] NA       NA       NA       NA       NA       NA       NA       NA      
 [25] NA       NA       NA       NA       NA       NA       "2.3 MW" NA      
 [33] NA       NA       NA       "2.3 MW" NA       NA       "2.3 MW" "2.3 MW"
 [41] "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW"
 [49] "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW"
 [57] "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW" "2.3 MW"
 [65] "2.3 MW" NA       "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
 [73] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
 [81] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
 [89] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
 [97] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
[105] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW"
[113] "3.2 MW" "3.2 MW" "3.2 MW" "3.2 MW" "2.3 MW" "4.5 MW" "4.5 MW" "4 MW"  
[121] "4 MW"   "4 MW"   "0.6 MW" "0.6 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW"
[129] "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW"
[137] "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW"
[145] "0.8 MW" "0.8 MW" "0.8 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW"
[153] "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW" "3.4 MW"
[161] "3.6 MW" "3.6 MW" "3.6 MW" "3.6 MW" "3.6 MW" "3.6 MW" "3.6 MW" "3.2 MW"
[169] "3.2 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[177] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[185] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[193] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[201] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[209] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW"
[217] "4.1 MW" "4.1 MW" "4.1 MW" "4.1 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[225] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[233] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[241] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[249] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[257] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[265] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[273] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[281] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[289] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.3 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[297] "4.3 MW" "4.2 MW" "4.2 MW" "4.3 MW" "4.2 MW" "4.2 MW" "4.3 MW" "4.2 MW"
[305] "4.3 MW" "4.2 MW" "4.2 MW" "4.3 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.3 MW"
[313] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.3 MW"
[321] "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.2 MW" "4.2 MW"
[329] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[337] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW"
[345] "4.2 MW" "4.2 MW" "4.2 MW" "4.2 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW"
[353] "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "4.3 MW" "3.6 MW"
[361] NA      

Exercise 2

Map wind farms and wind turbines with NVE data. Free but need to be download before reading into R (save it in a folder: e.g., ~/data/big_data/NVE/NVEData). I have download them in .geojson format. Therefore we need to read them with the geojsonsf package, which converts GeoJSON to an sfobjects.

Objetives

  • Formats of spatial data
  • Types of vector data
  • Plot more that one layer in a interactive map
  • Load data from files
  • Data wrangling

Solution

Code
# Libraries

library(geojsonsf)
library(sf)
library(tidyverse)
library(tmap)

Load data

Code
wind_turbines_nve_path <- "data/big_data/NVE/NVEData/Vindkraft_Vindturbin.geojson"
wind_turbines_nve <- geojson_sf(wind_turbines_nve_path)
wind_turbines_nve
Simple feature collection with 272 features and 5 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 4.905257 ymin: 58.31454 xmax: 6.51592 ymax: 59.41634
Geodetic CRS:  WGS 84
First 10 features:
   objektType   saksTittel saksKategori dataUttaksdato              eksportType
1  Vindturbin      Svåheia            2       20240207 NVEs nedlastningsløsning
2  Vindturbin       Tysvær            2       20240207 NVEs nedlastningsløsning
3  Vindturbin    Høg-Jæren            2       20240207 NVEs nedlastningsløsning
4  Vindturbin       Tysvær            2       20240207 NVEs nedlastningsløsning
5  Vindturbin    Bjerkreim            2       20240207 NVEs nedlastningsløsning
6  Vindturbin Vardafjellet            2       20240207 NVEs nedlastningsløsning
7  Vindturbin    Bjerkreim            2       20240207 NVEs nedlastningsløsning
8  Vindturbin   Måkaknuten            2       20240207 NVEs nedlastningsløsning
9  Vindturbin       Utsira            2       20240207 NVEs nedlastningsløsning
10 Vindturbin     Tellenes            2       20240207 NVEs nedlastningsløsning
                    geometry
1  POINT (6.091838 58.38779)
2  POINT (5.552303 59.31521)
3   POINT (5.76918 58.64514)
4   POINT (5.557336 59.2931)
5  POINT (5.934883 58.59081)
6  POINT (5.894319 58.83959)
7  POINT (5.945595 58.58838)
8  POINT (5.966087 58.68458)
9  POINT (4.906018 59.31497)
10 POINT (6.514851 58.34872)
Code
wind_farms_nve_path <- "data/big_data/NVE/NVEData/Vindkraft_VindkraftanleggOmr.geojson"
wind_farms_nve <- geojson_sf(wind_farms_nve_path)
wind_farms_nve
Simple feature collection with 57 features and 14 fields
Geometry type: GEOMETRY
Dimension:     XY
Bounding box:  xmin: 4.890143 ymin: 58.2376 xmax: 6.520988 ymax: 59.61306
Geodetic CRS:  WGS 84
First 10 features:
   dataUttaksdato totaltAntTurbiner    objektType utAvDriftDato idriftDato
1        20240207              <NA> Vindkraftverk          <NA>       <NA>
2        20240207              <NA> Vindkraftverk          <NA>       <NA>
3        20240207              <NA> Vindkraftverk          <NA>       <NA>
4        20240207              <NA> Vindkraftverk          <NA>       <NA>
5        20240207                37 Vindkraftverk          <NA>   20191219
6        20240207              <NA> Vindkraftverk          <NA>       <NA>
7        20240207              <NA> Vindkraftverk          <NA>       <NA>
8        20240207              <NA> Vindkraftverk          <NA>       <NA>
9        20240207              <NA> Vindkraftverk          <NA>       <NA>
10       20240207              <NA> Vindkraftverk          <NA>       <NA>
   status fylkesnavn
1       V   Rogaland
2       V   Rogaland
3       V   Rogaland
4      FJ   Rogaland
5       D   Rogaland
6      FJ   Rogaland
7      FJ   Rogaland
8       V   Rogaland
9       V   Rogaland
10     FJ   Rogaland
                                                                    saksLenke
1  https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=194
2   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=29
3   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=36
4   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=52
5   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=32
6   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=37
7   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=64
8   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=55
9   https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=53
10 https://www.nve.no/konsesjon/konsesjonssaker/konsesjonssak?type=A-6&id=120
   forventetProduksjon_Gwh kommunenavn                       geometry
1                     34.0   Stavanger POLYGON ((5.616381 59.07174...
2                    408.0   Bjerkreim POLYGON ((5.892451 58.63726...
3                    785.4   Bjerkreim POLYGON ((5.893369 58.70034...
4                    272.0        Lund POLYGON ((6.26167 58.56276,...
5                    558.4   Bjerkreim POLYGON ((5.995785 58.58672...
6                    306.0   Eigersund POLYGON ((6.206857 58.56671...
7                    306.0     Sokndal POLYGON ((6.153781 58.36661...
8                    544.0     Gjesdal POLYGON ((6.293888 58.82249...
9                    265.2   Bjerkreim POLYGON ((6.07609 58.68459,...
10                   204.0      Karmøy POLYGON ((5.29149 59.23401,...
   saksKategori               tiltakshaver effekt_MW              eksportType
1             2 MARIN ENERGI TESTSENTER AS      10.0 NVEs nedlastningsløsning
2             3         LYSE PRODUKSJON AS     120.0 NVEs nedlastningsløsning
3             3         LYSE PRODUKSJON AS     231.0 NVEs nedlastningsløsning
4             4          BJERKREIM VIND AS      80.0 NVEs nedlastningsløsning
5             2          BJERKREIM VIND AS     159.1 NVEs nedlastningsløsning
6             4          BJERKREIM VIND AS      90.0 NVEs nedlastningsløsning
7             4                  ZEPHYR AS      90.0 NVEs nedlastningsløsning
8             2     GILJA VINDKRAFTVERK AS     160.0 NVEs nedlastningsløsning
9             3                  ZEPHYR AS      78.0 NVEs nedlastningsløsning
10            4      EQUINOR WIND POWER AS      60.0 NVEs nedlastningsløsning

Map both together:

Code
tmap_mode("view")


tm_shape(wind_farms_nve) + 
  tm_fill("status", alpha = 0.5, title = "Wind farm status") +
  # Add wind turbines
  tm_shape(wind_turbines_nve) +
  tm_dots(col = "#0072B2")
Figure 2: Wind turbines in Rogaland (Data from NVE)

Status

D - Drift (Operations) N - Nedlagt (Decommissioned) O - Ombygd (Rebuilt) P - Planlagt (Planned) P1 - Planlagt illustrert (Planed illustrated) P2 - Planlagt, prosjektert (Planed, projected) U - Under arbeid (in progress) V - Vedtatt (Adopted) FJ - Fjernet (Removed)